package com.troila.cloud.simplify.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.troila.cloud.simplify.model.SOption;
import com.troila.cloud.simplify.repository.SOptionRepository;

@Service
@Transactional
public class SOptionService {
	
	@Autowired
	private SOptionRepository sOptionRepository;
	
	public void delOption(int id) {
		sOptionRepository.delete(id);
	}
	
	public void save(List<SOption> sOptions) {
		for (int i = 0; i < sOptions.size(); i++) {
			sOptionRepository.save(sOptions.get(i));
		}
	}
	
	public List<SOption> findByATitleId(int sTitleId){
		return sOptionRepository.findBySTitleId(sTitleId);
	}

}